+2007-10-02 Federico Mena Quintero <federico@novell.com>
+
+ Fix http://bugzilla.gnome.org/show_bug.cgi?id=455284 - In the file
+ chooser, Ctrl-L should switch to the location entry. If we are
+ already on the location entry, turn it off. Based on a patch by
+ Jaap A. Haitsma <jaap@haitsma.org> and an idea by Wouter
+ Bolsterlee.
+
+ * gtk/gtkfilechooserdefault.c (location_button_toggled_cb): Call
+ location_mode_set() directly instead of using toggle_location_mode().
+ (toggle_location_mode): Removed.
+ (location_toggle_popup_handler): If the file entry is not visible,
+ show it. If it is visible, turn it off only if it is focused.
+ Otherwise, switch to the entry.
+
2007-10-01 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
impl->location_mode = new_mode;
}
-static void
-toggle_location_mode (GtkFileChooserDefault *impl,
- gboolean set_button)
-{
- LocationMode new_mode;
-
- /* toggle value */
- new_mode = (impl->location_mode == LOCATION_MODE_PATH_BAR) ?
- LOCATION_MODE_FILENAME_ENTRY : LOCATION_MODE_PATH_BAR;
-
- location_mode_set (impl, new_mode, set_button);
-}
-
static void
location_toggle_popup_handler (GtkFileChooserDefault *impl)
{
- toggle_location_mode (impl, TRUE);
+ /* If the file entry is not visible, show it.
+ * If it is visible, turn it off only if it is focused. Otherwise, switch to the entry.
+ */
+ if (impl->location_mode == LOCATION_MODE_PATH_BAR)
+ {
+ location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY, TRUE);
+ }
+ else if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+ {
+ if (GTK_WIDGET_HAS_FOCUS (impl->location_entry))
+ {
+ location_mode_set (impl, LOCATION_MODE_PATH_BAR, TRUE);
+ }
+ else
+ {
+ gtk_widget_grab_focus (impl->location_entry);
+ }
+ }
}
/* Callback used when one of the location mode buttons is toggled */
GtkFileChooserDefault *impl)
{
gboolean is_active;
+ LocationMode new_mode;
is_active = gtk_toggle_button_get_active (toggle);
if (is_active)
- g_assert (impl->location_mode == LOCATION_MODE_PATH_BAR);
+ {
+ g_assert (impl->location_mode == LOCATION_MODE_PATH_BAR);
+ new_mode = LOCATION_MODE_FILENAME_ENTRY;
+ }
else
- g_assert (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY);
+ {
+ g_assert (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY);
+ new_mode = LOCATION_MODE_PATH_BAR;
+ }
- toggle_location_mode (impl, FALSE);
+ location_mode_set (impl, new_mode, FALSE);
}
/* Creates a toggle button for the location entry. */